import Vue from 'vue';
const getters = {
	token: (state) => {
		return !state.common.token ? Vue.prototype.$session.get('token') : state.common.token;
	},
	siteInfo: (state) => {
		let siteInfo = state.common.siteInfo;
		return Object.keys(siteInfo).length === 0 ? Vue.prototype.$local.get('siteInfo') : siteInfo;
	},
	menuData: (state) => {
		let menuData = state.common.menuData
		return menuData.length === 0 ? Vue.prototype.$local.get('menuList') : menuData;
	},
	authButton: (state) => {
		let authButton = state.common.authButton;
		return authButton.length === 0 ? Vue.prototype.$local.get('authButton') : authButton;
	},
	userInfo: (state) => {
		let userInfo = state.common.userInfo;
		return Object.keys(userInfo).length === 0 ? Vue.prototype.$local.get('userInfo') : userInfo;
	},
	departTree: (state) => {
		let departTree = state.depart.departTree;
		return departTree.length === 0 ? Vue.prototype.$local.get('departData') : departTree;
	},
	courseLabel: state => {
		let courseLabel = state.common.courseLabel;
		return courseLabel.length === 0 ? Vue.prototype.$local.get('courseLabel') : courseLabel;
	}
};
export default getters;